package by.admonko.universaltesting.services.impl;

import java.util.List;

import javax.inject.Inject;

import org.springframework.stereotype.Service;

import by.admonko.universaltesting.dataaccess.QuestionDao;
import by.admonko.universaltesting.datamodel.Question;
import by.admonko.universaltesting.datamodel.Test;
import by.admonko.universaltesting.services.QuestionService;

@Service
public class QuestionServiceImpl implements QuestionService {
	@Inject
	QuestionDao questDao;

	@Override
	public Question getQuestion(Integer id) {

		return questDao.getById(id);
	}

	@Override
	public void setQuestion(Question question) {
		questDao.insert(question);

	}

	@Override
	public void updateQuestion(Question question) {
		questDao.update(question);

	}

	@Override
	public void deleteQuestion(Integer id) {
		questDao.delete(id);

	}

	@Override
	public void deleteQuestionList(List<Integer> list) {
		questDao.delete(list);

	}

	@Override
	public List<Question> getQuestByTest(Test test) {

		return questDao.getByTest(test);
	}

	@Override
	public List<Question> getAll() {
		return questDao.getAll();
	}

}
